You want to find out how much memory is this program using .
Any code or function
i should add to find the total memory used by this program.
I don't want to check task manager for this.
I need to print the memory usage.
#include <stdio.h>
#include <string.h>
#define SIZE 30
int main()
{
char name[ SIZE ];
FILE *fpPtr;
if ( ( fpPtr = fopen( "sorted_file.txt", "r" ) ) == NULL ) {
printf( "File could not be opened\n" );
}
else {
printf( "%s\n", "Name" );
fscanf( fpPtr, "%s", name );
while( !feof( fpPtr ) ) {
printf( "%s\n", name );
fscanf( fpPtr, "%s", name );
}
fclose( fpPtr );
}
return 0;
};