so what I'm trying to accomplish is generating 100 random 0's and 1's add them all into one variable and then print it. What I have right now I don't know how to make work. If someone could explain what I'm doing wrong, I would be very grateful.
randstring (void){
int i;
int num;
char buffer[101];
i=100;
while(i>0, i--){
num = rand()%2;
strcpy(buffer, num);
}
return(buffer);
}
so what i have now is:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main (void){
printf("%f", randstring());
}
randstring (void){
int num;
char buffer[101];
int i = 100;
while(i-- >= 0) buffer[i] = rand() % 2;
return(buffer);
}