• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need quick C help please

Bluga

Banned
#1: Will the following print to file or stdout?

fprintf(stdout, "vertices=%d", graph(graph));

#2: Are these two the same?

int main (int argc, char **argv)

int main (int argc, char argv[])

#3: The following is a pointer to void, but what does it mean?

void *data
 
Do your own homework. 😛 I would recommend picking up a copy of K&R The C Programming Language. K&R are the creators of C.

1. Hint:

man fprintf
man stdout

2. No. You need to understand the correspondence between an array type and a pointer though. Any decent C book will cover this issue.

3. A void pointer is a generic pointer that can be assigned with *any* pointer type. However, you can't do much with a void pointer unless you cast it to a real pointer type.

man malloc to see a common usage of void *

Edit:
Damn you're fast Nothinman!
 
for item #1 - write a quick and dirty to test your conditions. You will find this method actually teaches you something and is usally faster than post a requst for help and waiting for responses.

Post requests for hard problems, not homework solving problems.
 
I like question #3. I'm a cs major and I was never taught about the pointer to void. That is very new to me. We were taught that void = nothing. Looks like I need to do a selfevaluation.
 
Back
Top