It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
ok guys,
this is a very good question in C code (not c++):
void *pName=function();
i'd like within "function()" to get the name of the pointer "pName", of course without passing it as an argument string to the same function.
and if you are really so good in C you can provide me the type of pointer, i mean for example:
char *pName=function();
i'd like to get name and type , so "pName" and "char" within the function.
thank you :)
This is not possible. The best you could do is write a macro (shudder) that passes the type and name as arguments to the function without you having to write them a second time.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
When we perform substitution, can one type substitute another type?
This is too broad a question because it concerns general concepts of programming rather than specific programming language.
Thank You.
Substitution of one type for another is purely dependent on your requirement.
You can also typedef the given type or you can make your own type.
You can perform type substitution using template also
Btw your question is little incomplete to give accurate answer , what exactly you want to ask?
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm trying to get the size of a file from the commandline in C using argv. I'm not too familiar with file i/o in C, so any pointers would be greatly appreciated. Thanks.
You've not stated the platform, but your C program is given an argument list when it is started, and the file names are strings. The POSIX function you'd probably use is stat(); it takes a pointer to a struct stat and will put the file's size into the st_size member of the structure.
The answer may be different on Windows; the POSIX subsystem will provide a stat() workalike (probably named _stat()), but there'll also be a native interface.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I do not know how to use "C", but have a working C program that I need to print a
program variable to determine what the program is doing. Can you tell me the easiest
way to do this
Jack
to print on stdout use printf function from stdio.h
To watch the values of a particular variable in Turbo c (windows)
Window-> watch -> enter your variable name. Then Press F7.
You can able to keep track the value of the variable.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm coming from a script guy, used to functions within 50 lines.
And when I see frequently functions over 200 lines,I'm really having a hard time reading it.
Is this normal at all?
There is nothing in the language that makes functions "long" - you can write long functions in any reasonable language, and, ideally, should refactor them into smaller, more understandable and maintainable functions in most languages.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
stdarg.h warns:
Warning: First arg is in a register,
stdarg.h cannot take its address
Why would the first argument will be stored in register?
Some calling conventions (eg fastcall) pass the first few arguments in registers instead of placing them on the stack. However, this makes taking the address of these variables impossible, and most implementations of variadic functions rely on this. Therefore, a compiler might additionally place the arguments on the stack as well as in registers or use a different calling convention for variadic functions.