c

where the local, global, static, auto, register, extern, const, volatile variables are stored ?

where the local, global, static, auto, register, extern, const, volatile variables are stored ? ...

Increasing number part of UIImageView variable in a for loop ?

Hi all, I have a three UIImageView variables called myPicture1, myPicture2 and myPicture3. In a for loop I am trying to increase the number at the end of myPicture by 1 so that I can assign a random image to each of the three variables. Here is the code below : for (i=0; i<3; i++) { int g = arc4random() % 19; NSString *imagename = [...

Does fwrite call any lock internally?

In solaris when I attached dbx to one of the running stacks, I found the call to fwrite leading to __lll_lock_wait()? In what scenario will this happen? Does fwrite internally tries to acquire a lock? ...

Can fwrite & fclose be called parallely from two threads for the same file descriptor?

What will happen if fwrite & fclose are called in parallel from two threads for the same file descriptor? ...

Box Based 3D terrain generation algorthms? (procedural generation)

I have been looking at this game called Minecraft and was intrigued by how it can dynamically generate random maps that look and feel right. What types of algorithms are used to generate terrains based on cubes like this? Thanks ...

dereferencing pointer to incomplete type

Hello, gcc 4.4.4 c89 Not sure why I am getting this error. In my header file I have the following handle.h typedef struct Handle_t Handle In my implementation file handle.c struct Handle { size_t id; char *name; }; Handle* create_handle(size_t id) { Handle *hdev = NULL; hdev = malloc(sizeof(*hdev)); /* Error */ ...

Explanation of postix, infix and prefix notation.

Would anyone be kind enough to explain what infix, postfix and prefix notation is in regards to the C programming language? Thanks, ~Daniel ...

String parser in C and C#

I have a string, "-(1-cos(R*T))/R", that I need to be evaluated in both C and C#. Is there a library, or a quick way to do this? Or do I need to write my own parser? I'm also assuming that R and T are known and are local variables. ...

What can cause fwrite to hang?

My code is hanging fwrite with the following stack: libc.so.6.1::___lll_lock_wait libc.so.6.1::fwrite This seems to be happening in solaris. Only incorrect thing which I can think of is that my code may try to do a parallel fclose on the same FILE pointer which is used for doing fwrite. If a parallel fclose happens will it lead to th...

I'm getting Invalid maximum heap size when I set Xmx and agentlib.

Here are the arguments that I am using: -Xmx1024m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=11999 The -Xmx1024m work fine without passing the -agentlib, and the -agentlib works fine without Xmx. Can you set the max heap size while using the agentlib? My jar file is getting launched via C code: execlp(myJavaPa...

How does the [] operator work?

I'm working with C, but I think this is a more low level question that isn't language specific. How does the program correctly grab the right data with array[0] or array[6] regardless of what type of data it holds? Does it store the length internally or have some sort of delimiter to look for? ...

How to control multiple robots through PC using Serial communication?

I want to control multiple robots using my laptop. Robots do not have intelligence, they are sending sensor values to PC which computes the sensors values and sends back result to robots.(Centralized control of robots using PC ). Robots are communicating with PC through serial communication using Zigbee mudule. Problem: How to make & ...

draw over opengl/D3D with GDI?

I'm wondering if it's possible to draw over an opengl/direct3D surface with GDI? and if so, how might it be done? The reason I ask is because I'm writing a simple app to draw a few things in games. Such things would all be 2D or text such as framerate info, custom crosshair, clock, etc. I know the best way is to hook in and use whateve...

Is this statically bound?

Say that I have a C program and it has this line: int a = 12; Is the value of 12 bound to 'a' during compile time? Or is the value placed into memory during run time when the scope of the program hits 'a'? What about programming languages like Python and Ruby? Are there languages/instances where a value is statically bound to a vari...

Comparison of array referencing methods

I need to print out a 3 by 3 matrix in C. I could think up of 3 different ways of doing it. Are all of them equally optimal or is one method better than the other? Function 1: Passing an 2darray, using array subscripts void printMatrix(int m[][3]) { int i,j; for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("%d\t",m[i][j]); } ...

Error with -mno-sse flag and gettimeofday() in C

A simple C program which uses gettimeofday() works fine when compiled without any flags ( gcc-4.5.1) but doesn't give output when compiled with the flag -mno-sse. #include <stdio.h> #include <stdlib.h> int main() { struct timeval s,e; float time; int i; gettimeofday(&s, NULL); for( i=0; i< 10000; i++); gettimeof...

Is there a way of using linked lists to simplify my Monte-Carlo code

Hiya, my code currently has three functions each producing a massive array of random numbers. Im wondering if there is a way of just having one function returning a linked list or multidimensional array to make it a bit neater: (copied from http://pastebin.com/Y5aE6XKS) #include <stdio.h> #include <stdlib.h> #include <math.h> #include...

From nmake: "no rule to make target `*.rc'"

I am in the process of trying to build putty tray, a variant of putty, from source on a Windows 7 system. I need to build it, not just download it, because I need to implement some additional functionality. I'm using nmake and (shouldn't be relevant) the Microsoft C++ compiler. To be precise, I'm working in a cmd window, I'm in the WINDO...

I want to make iphone apps but do i really need to learn objective c ?

I want to make iphone apps but do i really need to learn objective c ? I love Languages like Ruby, Python and PHP. Is it really worth me spending my time learning objective c ( i understand i have to learn c first)? Any advice, help, tips tricks would be greatly appreciated. Thank you in advance ;-) ...

An algorithm thats gives all possible distinct arrays whose positive integer elements sum to a given number.

Possible Duplicate: An algorithm to decompose a whole number into all possible sets of whole numbers that sum to it. An algorithm which for any input positive integer, gives all possible distinct arrays of positive non-zero integers that can sum to it. e.g Inputting 4 returns (1,1,1,1), (1,1,2), (1,2,1), (2,1,1), (1,3), (3,1)...