Fgets function does not work!

#include<cstdio>
using namespace std;
int main()
{
	int indis = 0;
	char* g, firma[50]; 

	cout << "firma adı giriniz: "; fgets(firma, 50, g);
	g = firma;

	while (g[indis] != NULL)
	{
		cout << g[indis];
		indis++;
	}
	return 0; 
}

why is fgets function not working?
error: C++ argument of type is incompatible with parameter of type

Okay it has been answered here. should use “stdin” instead of “g” in the fgets() function.

You’re mixing C and C++. Please don’t do that.

1 Like

Would you show me where did I do that in my code, please?

C doesn’t have namespaces so your use of <iostream>. C has puts and printf

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms