I currently have a struct that contains a pointer to an array of pointers. I am trying to give a value to an element in the array of pointers, but I ...
You cannot access a member of a structure without knowing what structure you are accessing. That is, if you can return a portion of a structure, you should be able to return the entire structure itself. If you are unable to see how, post some code showing where you run into difficulty.
eg. int x[6] (array with 7 elements) First, this is an array of 6 elements, not 7. trying to make x[2] = &x[2] but compiler says its an invalid conversion... Yes, there is a problem. x[2] is an int. Whereas, &x[2] is the address of an int. The compiler distinguishes between an integer and the address of an integer. There will ...
Im not quite sure what you want, but that code won't work. if you want to check the value of the item in an array see example below. On your if statement you need to compare the two values thats why its if(x==y). If you have if (x=y) the result would be that the value in x becomes the value in ...
#include #include int absolute(int *array, int N); int main() { int array[16] = {0,1,2,3,-4,5,6,7,-8,9,-10,11,12,13,14,20}; int ray[16]; int i; for ( i = 0; i < 16; i++ ) ray[i]=absolute(array,16); printf("the absolute value is %d\n", ray[i]); return 0; } int absolute(int *array, int N) { int i; for(i=0; i
#include #include #include void printfAll(int size, int ary[]) { int a; for(a=0; a< size; a++) { if(!(a%10)) //why a%10 and what not equal to it// printf("\n"); printf("%5d", ary[a]); } printf("\n"); } void printOddIdx(int size, int ary[]) { int a; for(a=1; a