Hello. Well, I completely get the most basic datatypes of C, like short, int, long, float, to be exact, all numerical types.These types are needed to be known perform right operations with right numbers. For example to use FPU to add two float numbers. So the compiler must know what the type is.
But, when it comes to characters I am li...
What is the difference??? I use Eclipse and there are several project types including Static Libraries and Shared Libraries? Does one have an advantage over the other?
...
I am experiencing a problem with a C program running on Windows XP that is getting Permission Denied (EACCES) errors when it tries to call system().
It doesn't seem to matter what I put in the command string, the commands all work manually but get Permission Denied errors when executed via system()
The other interesting thing is that ...
Say I declare a header file with a variable:
int count;
Then in the source file, I want to use count. Do I have to declare it as:
extern int count
Or can I just use it in my source file? All assuming that I have #include "someheader.h". Or should I just declare it in the source file? What is the difference between putting count in...
I have a static library project in Eclipse that was compiled into a .a file. So now how would I use the functions and constants in that library? Would I just put in into my includes:
#include "mylib.a"
...
Say I have a constant:
#define PI 3.14
Say I have a static library with multiple header and source files. If I declare this in the header file, will its scope apply to all of the source files? Or do the source files need to include the header with the declaration of PI?
...
6.3.1.8p1: Otherwise, the integer promotions are
performed on both operands. Then the following rules are applied to the promoted operands: If both operands have the same
type, then no further conversion is needed. Otherwise, if both operands have signed integer types or both have unsigned integer
types, the operand with the typ...
I am trying to compile a program I took off a cd from a book that uses directx to render 3d objects. when i press compile I get the following error
C1083: Cannot open include file: 'dxerr9.h': No such file or directory
I am using VC++ 2008 Express Edition and i am running off of Vista. I went to the following folder
[edit]
C:\Prog...
K&R C Programming Language: pg. 105
Extend entab and detab to accept the shorthand
entab -m +n
to mean tab stops every n columns, starting at column m.
entab replaces a number of spaces with a tab character and detab does the opposite. The question I have concerns the tab stops and entab. I figure that for detab it's ...
I have an open socket to a remote terminal. Using the answer to "Force telnet client into character mode" I was able to put that terminal into character mode.
My question is, how do I hide the cursor in the remote terminal using this method?
...
Today I found the following:
#include <stdio.h>
int main(){
char x = 255;
int z = ((int)x)*2;
printf("%d\n", z); //prints -2
return 0;
}
So basically I'm getting an overflow because the size limit is determined by the operands on the right side of the = sign??
Why doesn't casting it to int before multiplying work?
In this case I...
why pointer is more efficient or superior than declaring array?
...
Hi all,
I'm writing a C code for a class. This class requires that our code compile and run on the school server, which is a sparc solaris machine. I'm running Linux x64.
I have this line to parse (THIS IS NOT ACTUAL CODE BUT IS INPUT TO MY PROGRAM):
while ( cond1 ){
I need to capture the "while" and the "cond1" into separate strin...
I'm a bit fuzzy on the basic ways in which programmers code differently in C and C++. One thing in particular is the usage of strings in C++ over char arrays, or vice versa. So, should I use strings or char arrays, in general, and why?
...
I know that it's a common convention to pass the length of dynamically allocated arrays to functions that manipulate them:
void initializeAndFree(int* anArray, size_t length);
int main(){
size_t arrayLength = 0;
scanf("%d", &arrayLength);
int* myArray = (int*)malloc(sizeof(int)*arrayLength);
initializeAndFree(myArray, ...
I did the following steps to use the CDialog in win 32 application:
Changed the use of MFC to "use mfc shared DLL".
Added a dialog resource and added a class for the dialog.
Included the dialog class in my main.
Tried to call do modal.
when i try to call do modal...i am getting an debug assertion failed.. can anybody help me out of t...
As the title says, the java.io.tmpdir property in Java is really nice, and I can't find an equivalent for C. I'm writing for Windows and in Visual Studio. I don't want to just use something like C:\Temp because in later versions of windows the appropriate directory could be something like C:\Users\[UserName]\AppData\Local\Temp and a way ...
Hi, I've a problem , as the following code discribe itself.
1 #include<stdlib.h>
2 #include<stdio.h>
3 void log()
4 {
5 printf("Log [Line:%d]\n",__LINE__);
6 }
7 int main()
8 {
9 log();
10 log();
11 }
The expected result is
Log [Line:9]
Log [Line:10]
But, the fact is
Log [Line:5]
Log [Line:5]
No su...
Any reasons why this can not be standard behavior of free()?
multiple pointers pointing to the same object:
#include <stdlib.h>
#include <stdio.h>
void safefree(void* p = NULL;
}
int main()
{
int *p = (int *)malloc(sizeof(int));
*p=1234;
int*
printf("p=%p p2=%p\n", p, p2);
safefree((void*
printf("p=%p p2=%p\n"...
I am trying to use Eclipse to build some existing software (written in C), which is built with a Makefile. For this reason I created a 'Makefile project' in Eclipse.
However, I just found out, the in the 'C/C++ Build / Settings' menu, I only see the 'Binary Parsers' and 'Error Parsers' tabs. However, I really need the 'Build Steps' tabs...