If a particular type(say int,char,float,..) pointer is incremented the value of pointer variable increased by number which is equal to size of the particular data type.If a void pointer points to data of x size for increment operation how it will point to x size ahead? How compiler knows to add x to value of the pointer?
...
Question : Program that asks the user to enter an item price value and then show how to pay that amount using the smallest number of $ 50,$20, $10,$5, and $1 bills consist.
Example Output:
Enter Price: 187
Enter Amount to pay: 500
Change is : 313
(6)$50 (1)$10 (3)$1
(0)$20 (0)$5
Here's my code: hope you help me , I am having a ...
I've asked many, many C questions here on stackoverflow over the past few days. I feel like I'm at the final one. My assignment works ALMOST perfectly. Here is the premise:
Write a program to query the user for two input strings. Each input string should be a unix command, with arguments allowed. For example, input 1 could be ls -l and ...
I have some functions that are designed to handle 1-256 bytes, running on an embedded C platform where passing a byte is much faster and more compact than passing an int (one instruction versus three), what is the preferred way of coding it:
Accept an int, early-exit if zero, and otherwise copy the LSB of the count value to an unsigned...
What's a high-level description of OpenMP?
The Wikipedia article states that "OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C, C++ and Fortran on many architectures, including Unix and Microsoft Windows platforms. It consists of a se...
I've been playing with GLib's D-Bus bindings, trying to get something (anything) working, with very limited success. I've been trying to get Ross Burton's example code to compile and run, but keep hitting new and exciting difficulties.
Can you help debug this code, or failing that, point me at some example of D-Bus GLib code that does w...
If I create a button in the Win32 API, the default conrol theme looks like a Windows 95/98 button. I remember in the past the Microsoft forums told me how to get the XP style, but I don't recall how to do this. Is there a way to programatically or manually change the control themes in a Win32 application? Thanks.
...
int main(void)
{
char four[4] = "four";
return 0;
}
When compiled as a C++ program, G++ reports
xxx.cpp: In function int main():
xxx.cpp:3: error: initializer-string for array of chars is too long
When compiled a a C program, GCC reports no error.
It appears to me, that the assignment is correctly copying all 4 bytes into t...
Good day all,
I need you guys assistance on this problem I can't figure out how to go around this at the moment.
I have a file that contains dates in the format below.
03\03\2010
04\03\2010
05\03\2010
06\03\2010
07\03\2010
08\03\2010
09\03\2010
10\03\2010
. . .
. . .
. . .
I want to get the line number of any specified date stri...
Is there a limit to how many times a loop can run in C?
void main()
{
int T,N,x,X,i;
x=0;
scanf("%d",
while(T>0)
{
T--;
scanf("%d",
X=0;
while(N>0)
{
N--;
scanf("%d",
if(x>X){X=x;}
}
printf("Case: %d",x);
}
}
T has a ra...
I have a bison grammar for collecting arguments of a function. This is what it is so far:
args: arg {$$ = intArray($1);} //pseudo-code function
| args arg {$$ = $1 + $2;} //pseudo-code array addition
arg : NUM {$$ = $1;}
| exp {$$ = $1;}
How can I create an array of inte...
I have some software that I have working on a redhat system with icc and it is working fine. When I ported the code to an IRIX system running with MIPS then I get some calculations that come out as "nan" when there should definitely be values there.
I dont have any good debuggers on the non-redhat system, but I have tracked down that so...
I am wondering which tool can be used in Xcode to generate the documentation for an iPhone project, so written in objective-C and C mostly, but also helping designing the code.
The documents I'd like to be produced are:
UML-like class diagrams (with generalization, aggregation and composition relationships)
UML-like components diagram
...
How do you make C use the For Loop Statement and generate this:
1
12
123
1234
12345
123456
1234567
12345678
I know this requires that the value "1" to be continuously be multiplied with "10" and added with "1".
...
I am developing a program using cuda sdk and 9600 1 GB NVidia Card . In
this program
0)A kernel passes a pointer of 2D int array of size 3000x6 in its input arguments.
1)The kenel has to sort it upto 3 levels (1st, 2nd & 3rd Column).
2)For this purpose, the kernel declares an array of int pointers of size 3000.
3)The kernel then ...
I have a thread that needs to write data from an in-memory buffer to a disk thousands of times. I have some requirements of how long each write takes because the buffer needs to be cleared for a separate thread to write to it again.
I have tested the disk with dd. I'm not using any filesystem on it and writing directly to the disk (open...
How to Run C Code Block from Erlang? ( Or Call a C function from erlang? )
...
I know static is an overloaded keyword in C. Here, I'm only interested in its use as a keyword to enforce internal linkage.
If you have a global variable declared in a .c file, what is the difference between using static and not using static? Either way, no other .c file has access to the variable, so the variable is basically "priva...
how to do? User type some numbers and then another function return result of addition of these numbers? (C/C++)
for example, user type in 3 4 7 and then he see printed on screen 14
another one, user type 5 6 and gets 11
I'm a beginner in programming C, so I ask you to help me, please
...
Hey guys I was wondering how I should do dynamic arrays in objc. Currently I have a function I wrote called malloc2D that looks like this:
void* malloc2D(size_t unitSize, uint firstCount, uint secondCount){
void** pointer = malloc(sizeof(id) * firstCount);
for (int i =0; i < firstCount; i ++){
pointer[i] = malloc(unitSize * second...