Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int a = 5;
- int i;
- for (i = 1; i <= a; i++) { // i = 6
- printf("%d\n", i);
- }
- printf("%d\n", i);
- }
- // int main() {
- // FILE *file;
- // file = fopen("input.txt", "r");
- // char name[500];
- // int id;
- // double marks;
- // // EOF = 0 fscanf = 0 0 != 0
- // if(file == NULL) {
- // printf("File does not exist!\n"); // EOF = End of File
- // } else {
- // while(fscanf(file, "%s %d %lf", name, &id, &marks) != EOF) {
- // printf("%s %d %lf\n", name, id, marks);
- // }
- // }
- // }
- // reading data from file
- // int main() {
- // FILE *file;
- // file = fopen("input.txt", "r");
- // char name[500];
- // int id;
- // if(file == NULL) {
- // printf("File does not exist!\n");
- // } else {
- // // taking input from console
- // // scanf("%s", name);
- // // taking input from file
- // fscanf(file, "%d", &id);
- // printf("%d\n", id); // output -> console
- // fprintf(file, "%d\n", id); // -> file e print korbe
- // }
- // }
- /*
- Creating a new File
- fopen("file path", file_mode);
- opening an existing file
- fopen("file path", file_mode);
- closing a file
- fclose(file_pointer);
- Reading from and writing information to a file
- To write something in a file ->
- fputs(string, file)
- fprintf(file_pointer, formate_specifier, variable_Name)
- To read something in a file ->
- fgets(variable, size, file_pointer)
- fscanf(file_pointer, formate_specifier, variable_name) ---> %[^\n]
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement