What is char ** in C?

Possible Duplicate:What is double star? I am fairly new to C, and have come across this statement I have a pretty good idea of what typedef does, but I have never seen char** before. I know that char* is a char array or similiar to a string. Im not sure if char** is a 2d … Read more

Categories C Tags

error: expected declaration or statement at end of input in c

Normally that error occurs when a } was missed somewhere in the code, for example: would fail with this error due to the missing } at the end of the function. The code you posted doesn’t have this error, so it is likely coming from some other part of your source.

Categories C Tags

Try catch statements in C

C itself doesn’t support exceptions but you can simulate them to a degree with setjmp and longjmp calls. This website has a nice tutorial on how to simulate exceptions with setjmp and longjmp http://www.di.unipi.it/~nids/docs/longjump_try_trow_catch.html

Categories C Tags

How to replicate vector in c?

Vector and list aren’t conceptually tied to C++. Similar structures can be implemented in C, just the syntax (and error handling) would look different. For example LodePNG implements a dynamic array with functionality very similar to that of std::vector. A sample usage looks like: As can be seen the usage is somewhat verbose and the code needs to be … Read more

Categories C Tags

What does strcmp() exactly return in C?

From the cppreference.com documentation Return value Negative value if lhs appears before rhs in lexicographical order. Zero if lhs and rhs compare equal. Positive value if lhs appears after rhs in lexicographical order. As you can see it just says negative, zero or positive. You can’t count on anything else. The site you linked isn’t incorrect. … Read more

No Symbol Table using GDB on Compiled Programs

The No symbol table loaded message you are getting is misleading: all GDB is telling you is that your binary does not have any debugging info in it. Usually this is solved by rebuilding the binary with -g flag, but since you are given an already compiled and linked file, you can’t do that. Without debug info, certain commands, such as list, break … Read more

Warning comparison between pointer and integer in C language

I’m assuming that this “type_of_assessment” variable is of char * (pointer to a character) so when you are comparing a character to a char pointer it throws this error. This char * variable stores the address of the actual value stored so you have to de reference it first. Try this in your if condition:

Categories C Tags

double free or corruption (fasttop)

The problem is here: Basically, when you free temp2, you free first, not the memory allocated here: , which remains a memory leak, because after the assignment it can’t be freed anymore. Also, your code has probably some more problems (one is that you shouldn’t use fflush on an input stream), but without some more details, it’s … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)