Questions tagged as 'c'

2
answers

Is it possible to implement a dynamic array inside a C structure?

How is it possible to create a dynamic array inside a structure Example typedef struct historico_de_fabrica { Hist_id_rolos rolos[1000]; //<- este array em vez de ter 1000 posições queria em //memoria d...
asked by 24.04.2014 / 19:06
4
answers

When to implement functions in the header?

I often split the program into small modules, each with its own header and implementation. In general, the level of abstraction used allows the implementation to be completely changed without breaking the rest of the module-dependent code. In...
asked by 30.01.2014 / 16:58
2
answers

What is the C / C ++ volatile operator?

I've seen some code in C / C ++ statements like this: volatile int i = 0; I would like to know what the volatile operator is and in what cases I should use it.     
asked by 22.03.2014 / 15:16
2
answers

What does this piece of cast code do?

code taken from Linux x86_64 execve Shellcode #include<stdio.h> #include<string.h> unsigned char code[] = \ "\x48\x89\xc6" // mov %rax,%rsi "\x48\x89\xf2" // mov %rsi,%rdx "\x49\...
asked by 21.06.2016 / 22:08
1
answer

How to pass an array as an argument of a function per copy?

As an array is used as a pointer in many situations . A parameter that expects an array is actually a pointer, so what it copies is the memory address and not the array data, p> But what if I want to get the data right? I know the size...
asked by 27.01.2017 / 13:00
1
answer

What is a linker for?

Some languages use a linker or Wikitravel as it is also called. What is its function and relationship to the compiler? Why do some languages do not have a linker ?     
asked by 21.03.2017 / 16:01
1
answer

Why performing offloading to the GPU is a good idea?

I'm following a few forums on the internet and I realize that recently there has been a lot of talk about doing offloading tasks for the GPU. Mozilla has implemented a new engine for your browser called Servo . In his heart he makes...
asked by 23.02.2017 / 20:57
3
answers

Colo allocate a memory based on the size of what the user entered

How can I make the program count the number of 'x' characters of the string and give X bytes to it immediately after the user enters a string? I am not able to do this, I tried for example to make after the user type the string, this: ponte...
asked by 04.01.2015 / 17:10
3
answers

Can a global pointer point to a local variable?

In the case below, for example: int *pnum; void main(){ int num = 10; pnum = &num; } What would happen if I tried to access the pointed value of the pointer outside the main function?     
asked by 21.11.2015 / 01:52
1
answer

cin vs scanf, which one is faster?

In competitive programming, it is common for many programmers to use scanf() and printf() in C ++ code instead of using cin and cout . And I've even seen problems that result in a Time Limit Exceeded (TLE) when us...
asked by 01.05.2016 / 22:47