C
Carramba
Hi!
I have written some peace of code, but I wonder if it's legal for ansi-c
I have no problem to compiling it, but since I'm inexperience and the
output is not correct I have doubts. Thank you for help!
#include <stdio.h>
#include <stdlib.h>
#define __buff(s, c) s_c
int main(){
int i;
for(i=0;i<10;i++){
int __buff(*send,i);
}
for(i=0;i<10;i++){
__buff(send,i) = i;
}
for(i=0;i<10;i++){
printf("%d \n",__buff(send,i));
}
return 0;
}
The output is always 3...
My intentions is to deal with several int pointer with loops, since I'm
lazy to write all int's...
I want to make X number of int pointer
int *pointer_1
.....
int *pointer_X
allocate memory for all
pointer_1=malloc(sizeof( *pointer_1))
.....
pointer_X=malloc(sizeof( *pointer_X))
fill them with values
and do something
if this way not proper is there a "hack" for lazy programmer like me?
Thank you again!
L R
I have written some peace of code, but I wonder if it's legal for ansi-c
I have no problem to compiling it, but since I'm inexperience and the
output is not correct I have doubts. Thank you for help!
#include <stdio.h>
#include <stdlib.h>
#define __buff(s, c) s_c
int main(){
int i;
for(i=0;i<10;i++){
int __buff(*send,i);
}
for(i=0;i<10;i++){
__buff(send,i) = i;
}
for(i=0;i<10;i++){
printf("%d \n",__buff(send,i));
}
return 0;
}
The output is always 3...
My intentions is to deal with several int pointer with loops, since I'm
lazy to write all int's...
I want to make X number of int pointer
int *pointer_1
.....
int *pointer_X
allocate memory for all
pointer_1=malloc(sizeof( *pointer_1))
.....
pointer_X=malloc(sizeof( *pointer_X))
fill them with values
and do something
if this way not proper is there a "hack" for lazy programmer like me?
Thank you again!
L R