User Profile
Collapse
-
. This function is used to flush any data in output stream. So this will compile but its behavior is undefined by the ANSI C standard. The fflush() function is only meant to be used on streams open for output, not input. Both fflush(stdin) and fflush(NULL), in some C libraries, will flush stdout and stderr, but this is completely unportable! Thus, it should not be used. -
This is happening bcoz of recurrive calls for function myfunc(). Use a debugger and go step by step you will get the answerLeave a comment:
-
You should clearly explain desired behaviour from the code and the problem your are facing.Leave a comment:
-
-
-
Solution suggested by akshay will not solve the segv.Yo have declared a array of char. pointer & before paasing to function you never initialsed it.Leave a comment:
-
Hope this helps
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
float A[4000] = {0};
FILE *pFile;
int main ()
{
int c, i = 0;
pFile=fopen ("text.txt","r" );
if (!pFile)
{
printf("failed to open file\n");
exit (1);
}
do
{
...Leave a comment:
-
-
There are many flaws in your programm.
line 18: when you use fgetc, it will increment the file pointer then you do fscanf which expects first argument as interger. since file poiter is increment the value it will fetch is an float. and in such cases result is undefined.
line 20 : you should give &i instead of i.
line 21 : Should properly typecast values.Leave a comment:
-
Make a habit of returning return codes from API's instead of returning pointers. pointers which needs to returned should be passed as argument to API's. This will also help in making APIs thread safe.Leave a comment:
-
He is not printing adrress. infact he is printing garbage values. this is happening bcoz of break stament at line 30. As soon as *ptr == 2 u break from for loop and do ptr = ptr - 99. Bcoz of this ptr starts pointing some garbage location so when loop stars at line 45 it start with printing garbage valuesLeave a comment:
-
Instead of scanf u should use fgets(). Scanf will not do array boundry check and will terminate reading at first space.Leave a comment:
-
mayankarpit replied to toupper() function implementation using Bitwise operations --- Speed differencein Cuse gettimeoftheday () before and after the mask option.Same with toupperLeave a comment:
No activity results to display
Show More
Leave a comment: