help on good old C
-
since no one is online elsewhere, here it goes explain int *p; p=(int (*)[4])malloc (3*sixeof(*p)) please
-
since no one is online elsewhere, here it goes explain int *p; p=(int (*)[4])malloc (3*sixeof(*p)) please
What exactly are you wanting to know about the two statements?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
since no one is online elsewhere, here it goes explain int *p; p=(int (*)[4])malloc (3*sixeof(*p)) please
-
since no one is online elsewhere, here it goes explain int *p; p=(int (*)[4])malloc (3*sixeof(*p)) please
-
since no one is online elsewhere, here it goes explain int *p; p=(int (*)[4])malloc (3*sixeof(*p)) please
I can't. I'm guessing sixeof is a typo and you ment sizeof. (a forgivable mistake unless you really ment sixeof, in which case I'd need to know more about it) the int (*)[4] part is wrong. It is tyring to tell the compiler that you have an array of 4 ints, but just allocated 3! Not that the compiler would check, it is legal C to then use p[5], though it is undefined behavior and will randomly crash your program. Just write int *p = malloc(3*sizeof(int)); like the rest of us would.
-
since no one is online elsewhere, here it goes explain int *p; p=(int (*)[4])malloc (3*sixeof(*p)) please