Questions tagged as 'c'

2
answers

Memory access

Can someone tell me what the following lines do? num = *((int*)(direccion+sizeof(char))); (*(ST_DATA*)(direccion+posTabla*sizeof(ST_DATA))).speed = num; Do the next two lines mean the same thing? *((int*)(direccion + OFF_TABLE_KEY+sizeof...
asked by 24.05.2018 / 12:01
1
answer

Change variable by call to function

I need to know if this can be done, I think with pointers it could be but I do not know what form. On the one hand we have a function cambiarValor void cambiarValor (int a){ a=a*4; } and on the other hand the main from whe...
asked by 09.05.2018 / 12:31
3
answers

Limit selection of random positions in a two-dimensional array

I'm doing a minesweeper that should have size 10 * 10 and within this I must locate 10 mines in random positions. My problem is that when generating the random positions, these are, in some cases, repeated and therefore overwritten. That is,...
asked by 16.09.2017 / 04:02
1
answer

Help with this problem in C

I leave here the code of a vector that I have made but I have no idea why it does not do what it should. I have put a variable called cantidad , and a vector[cantidad] so that the user can manage the values of the array but only...
asked by 24.07.2017 / 17:55
6
answers

C drawing patterns

I am doing the exercises before the programming exam and I can not do this: "Write a program that receives a natural number and paint approximately a square figure on a screen using a given drawing pattern, for example, if you read the number...
asked by 28.12.2016 / 17:06
2
answers

I can not clean the keyboard buffer in C

In my code, I request a series of data from the user using the gets() function. The problem is that at a certain point in the program when requesting a data with gets() it simply jumps to the next request and leaves the variable bl...
asked by 14.07.2016 / 03:01
2
answers

What is the difference between these two types of pointers?

What exactly is the difference between these two pointers if both are pointing to a function. The truth is that I have seen many programmers using them but I still do not see the difference. int(*function)(int,int) and int*function(int,...
asked by 06.05.2018 / 17:10
1
answer

The linked list does not point to NULL at the end

I have a problem with the following program. This consists of adding elements to a linked list in an increasing way, that is, the elements will be sorted in the list from least to greatest, with the lowest value being the "head" of the list and...
asked by 18.03.2018 / 05:27
5
answers

C / C ++ - Pointers

I have a question about the following code: int main() { int *x, *y; int i; i = 10; x = &i; y = x; *x = *y +1; cout << i << endl; *y = *x + 1; cout << i << endl; return 0; }...
asked by 06.01.2018 / 16:23
2
answers

Error: uninitialized local variable 'x' used

Good afternoon or everyone's day, I want to ask you for help with this little error that I have, I ask for help because I have already tried several things and I still get this error, I have almost no experience using functions in c, but here I...
asked by 02.08.2017 / 03:28