I have to find a way to display the Maximum and Minium number in an array, the size of the array is 100 and will not exceed that and there is not need for input validation. The program will keep asking for input until 0 is encountered and it too will get added to the array.
I have everything figured out except how to keep track which is...
Possible Duplicate:
What is the point of function pointers?
hi all,
I want to get the basic and concrete idea of function pointers in C language.
ie 1) its usage in C
2) main applications it is currently using
3) unique features
4) its scope in embedded applciations etc
Hoping your co operation in this too.
__Kan...
Hi all,
I'm using RHEL 5.3 (linux 2.6.18)
I have a legacy code that relies on timezone and dst returned by ftime(3).
Now from ftime(3) man pages I see that timezone and dstflag are not supported.
Also in gettimeofday(3) those fields are not supported.
How I can retrieve timezone and dst?
Thanks
...
I want to save a multidimensional array to a file. A struct for example:
struct StructSub {
unsigned short id;
};
struct MyStruct {
struct StructSub sub[3];
};
// Use the struct
struct MyStruct main;
int i = 0;
while (i < 3) {
main.sub[i].id = i;
i++;
}
For this example I want to save the data to a file in this format...
Just to test, I ran this code
#include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
int main() {
int **ar = (int**) malloc(100000000* sizeof(int*));
int i;
for(i = 0; i<10000000; i++) {
ar[i] = (int*) malloc(1000 * 4);
ar[i][123] = 456;
}
usleep(3000000); usleep(3000000);
usleep(3000000); us...
Recently I attended an interview where they asked me to write a C program to concatenate two strings without using strcat(), strlen() and strcmp() and that function should not exceed two (2) lines.
I know how to concatenate two strings without using strcat(). But my method has nearly 15 lines. I dont know how to write it in two lines.
...
unsigned char ascii;
int a = 0;
char string[4] = "foo"; "A1"
ascii = (string[a] - 'A' + 10) * 16;
warning: conversion to ‘unsigned char’
from ‘int’ may alter its value
It seems that gcc considers chars and number literals as int by default. I know I could just cast the expression to (unsigned char) but how can I specify char lite...
hi all,
i'm trying to take a screenshot on osx with c/c++
so far this is what i got:
#import <ApplicationServices/ApplicationServices.h>
int main( int argc, char** argv) {
CGImageRef screenShot = CGWindowListCreateImage( CGRectInfinite,
kCGWindowListOptionOnScreenOnly, kCGNullWindowID, kCGWindowImageDefault);
CFStringRef fi...
Possible Duplicate:
What is the best way to learn C? What next after K&R?
Hello,
sorry ,i was supposed to write c-programming .I am new to programming but i am studying using refernces available on Internet.
Could anyone can give me reference link or book name in which i can learn about c-programming on linux thoroughly and ...
I'm looking to run multiple concurrent processes in a C program. The programs will take arguments from the user and then execute each argument as a child process. I think that means that all I need to do is ensure that the fork() is performed by the original parent process each time, and then each of the resultant child processes will ru...
How is the conditional operator represented using bitwise operators?
Edit:
Sorry for the poor explanation. It is a homework question where I have to implement the conditional operator using only bitwise operations. It would be simple if if statements were allowed, however it has to be strictly bitwise operators. The function takes in...
Hi all,
I have to implement some mechanism in C on SOLARIS 9 SPARC in order to allow interprocess communication.
In a nutshell, i have to implement a multithread program where the father of the thread once receive a signal, or whatever you want, has to trigger a set of thread that are in charge of encrypting files.
I cannot use some T...
What, exactly, is numbers in the following declaration, if it is not an address constant?
int main() {
int numbers[3] = {1,2,3};
return 0;
}
Disassembling the program shows that 1, 2, and 3 are dynamically placed on the local stack space, rather than the whole array being treated as a constant. Hence, {1,2,3} does not have sta...
Possible Duplicate:
Can all iterative algorithms be expressed recursively?
Is it always possible to convert a iterative function in a recursive function?
...
Hi,
could you recommend some website for C debugging puzzles?
Thanks
...
I'm developing a C-program with VS2005 and I found out that when folder access is restricted in a way that I can't create folders or delete anything from a folder the _stat function for the folder does not set errno correctly. errno is set to value ENOENT. I absolutely cannot modify the permissions so I could get value EACCES. Either _st...
Suppose I would like to create a new programming language by only adding a new primitive datatype to C, say boolean. What would be needed to do this?
EDIT: I'm not making myself very clear here. I would like to design a new language, with the syntax being exactly like C, but with a bunch of new primitive datatypes. This language should ...
Hi,
I worked with Visual Studio 2008 in a C project without problems. Now I added the same source files to Visual studio 2010, compiled it without problems but when I debug the program I get:
Unhandled exception at 0x00417257 in da34.exe: 0xC0000005: Access violation reading location 0x00030000.
Looking at the code I just can see this...
I am writing a Python program which should do some simulation. I have a working code example in C, which uses the FFTW library (version 2.1.5) to do Fourier transforms.
A simplified version of the C code is as follows:
#include <rfftw.h>
#include <stdio.h>
#include <math.h>
int main(int argc, char** argv)
{
size_t i, n = 2;
ff...
Hi,
I am trying to learn the basics, I would think that declaring a char[] and assigning a string to it would work.
thanks
int size = 100;
char str[size];
str = "\x80\xbb\x00\xcd";
gives error "incompatible types in assignment". what's wrong?
thanks
...