Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char *argv[]) {
- printf("Hello world\n");
- FILE *pz = fopen("plik.txt", "w");
- //int x = '1' ;
- //printf("%c\n",x);
- srand(time(NULL));
- int *p;
- int size_p = 10;
- char *pc;
- p = malloc(size_p * sizeof(int));
- pc = malloc(size_p * sizeof(char));
- int i = 0;
- int j;
- for (i = 0; i < size_p; i++) {
- p[i] = rand() % size_p;
- //printf("%d ",p[i]);
- }
- puts("");
- //puts(pc);
- //fputs(pc,"plik.txt");
- for (int i = 0; i < size_p; ++i)
- {
- fprintf(pz, "%d", p[i]);
- }
- free(p);
- free(pc);
- fclose(pz);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement