Implement an array of stacks where stacks are defined :
typedef struct StackNode {
int data;
StackNode* next;
} StackNode;
Each array element points to a stack, each stack is initialized as an empty stack.
When you start adding elements it will start adding them to the stack in Stacks[0];
if you say -2 in stdin and then 4 for...
Hello,
C99 gcc
I have a buffer and I don't want the user to enter anymore to avoid a buffer overrun.
I am using scanf and have done like this:
char buffer[30] = {'\0'};
scanf("%30s", buffer);
However, I know I am protected if the user enters more than 30. However, if the user enters more than 30. Will the buffer be null terminated?...
Write a program to access the function "foo" using the structure structure2.
typedef struct
{
int *a;
char (*fptr)(char*);
}structure1;
typedef struct
{
int x;
structure1 *ptr;
}structure2;
char foo(char * c)
{
---
---
---
}
...
While compiling my program which is using libevent library I am using gcc option -levent. But I am getting this error -
/usr/bin/ld: cannot find -levent
I do not have libevent on my system so I am statically linking to it while compiling using
gcc -o Hello -static -I libevent-1.4.12-stable/ hello.c -levent
How can i resolve this?
...
I want to measure the execution time of for loops on various platforms like php, c, python, Java, javascript... How can i measure it?
I know these platforms so i am talking about these:
for (i = 0; i < 1000000; i++)
{
}
I don't want to measure anything within the loop.
Little bit modification:
@all Some of the friends of mine a...
When an assertion fails with Visual C++ on Windows, the debugger stops, displays the message, and then lets you continue (or, if no debugging session is running, offers to launch visual studio for you).
On Linux, it seems that the default behavior of assert() is to display the error and quit the program. Since all my asserts go through ...
Hi there.
I was wondering if there was any way to pass parameters dynamically to variadic functions. i.e. If I have a function
int some_function (int a, int b, ...){/*blah*/}
and I am accepting a bunch of values from the user, I want some way of passing those values into the function:
some_function (a,b, val1,val2,...,valn)
I don...
From the Plt-Scheme installation I have an example of C/Scheme interaction. There are two files: curses.c and curses-demo.ss. These files are available here.
I've compiled curses.c, and trying to run curses-demo.ss
And I am getting the following error: "put: expects argument of type 'character, string, or byte string'; given "Hello Worl...
Its a simple but important question. What are the do's and donts while using a pointers in C and C++ so as to make sure SEGMENTATION FAULT is avoided on AIX?
Where char * are preferred over character array?
...
How to generate an efficient square waveform with varying duty cycle using C language?
...
Hi,
What are the naming conventions commonly use in C? I know there are at least two:
GNU / linux / K&R with lower_case_functions
? name ? with UpperCaseFoo functions
I am talking about C only here. Most of our projects are small embedded systems in which we use C.
Here is the one I am planning on using for my next project:
C Na...
How do I put the records from the random access file DATA.data into the array allRecs[10]?
/*Reading a random access file and put records into an array*/
#include <stdio.h>
/* somestruct structure definition */
struct somestruct{
char namn[20];
int artNr;
}; /*end structure somestructure*/
int main (void) {
int i = 0;
...
Suppose in a program we have implemented a stack. But who creates the stack ? Is it the processor, or operating system, or compiler?
...
Hi,
I'm trying to compile a program running on an HP UX server on a Red Hat Linux.
It uses xerces-c library to parse xml files. Compilation is ok, but when i try to run it, I get the following message
./a.out: error while loading shared
libraries: libxerces-c.so.28: cannot
open shared object file: No such file
or directory
...
i googled about it and some where i read ....
Yes, you can. That is happening in the case of embedded systems
As per i think,
NO, its not possible. Any platform must have an operating system. Or else, your program must itself be an OS.
Either soft or hard-wired. Without an operating system your component wouldn't work.
Am i right or c...
i am working on php...!!
Is it possible to link HTML page to c++/c at back end.
means instead of php script i want to run c/c++
if Yes How??
...
Is there a way to list all subdirectories in a given directory path in C? I was hoping I would be able to do it with the stat() function but it only works on files.
...
Hello,
void functions::start()
{
io_iterator_t enumerator;
...some code...
result = IOServiceAddMatchingNotification(
mNotifyPort,
kIOMatchedNotification,
IOServiceMatching( "IOFireWireLocalNode" ),
serv...
Check the following code snippet
struct st
{
struct st
{
int a ;
int b ;
} st;
int a1 ;
} ;
struct st obj ;
struct st obj1 ;
int main()
{
return obj.a1 + obj1.b ;
}
Microsoft's compiler Visual Studio 6.0 compiles the program succesfully. I am confused with the use of 'struct st'. What is the size of ob...
Hello,
I'm following this tutorial on x86 assembly. Every example so far uses what the author calls a "c-driver" program, compiled with the assembly module, for means of some "initialization". Something like:
int main(void) {
int ret = asm_main();
return ret;
}
And then the asm_main function is written normally, using a C calling...