Am I missing something incredibly simple? because I can't seem to find a reason why my code isn't storing strings dynamically. All I get are blank lines when I print them at the end. Its supposed to print the last "n" lines of an arbitrary number of lines. There seems to be a problem with the storage of the actual lines though. Can anyon...
I found a few questions similar to mine but none of the answers are satisfactory and they are a few years old. So I am hoping that perhaps some progress has been made on that front since then.
What I am interested in is the ability to access the content of an active Firefox window and copy it to the clipboard -- using C or C++ code.
In...
Possible Duplicate:
How do we explain the result of the expression (++x)+(++x)+(++x)?
int i=2;
i = ++i + ++i + ++i;
Which is more correct? Java's result of 12 or C = 13. Or if not a matter of correctness, please elaborate. Thank you.
...
Hi,
This might be an often repeated question, sorry for bringing it back again. I was unable to find a solution :( . I am writing a VM monitoring code in C in Linux. I want to get the read and write count of all the VM's every 10 seconds. Is there any C library that provides this feature(timer alone), blocking/non-blocking timer doesn't...
#include<stdio.h>
int main(void)
{
int i=1,j=-1;
if((printf("%d",i))<(printf("%d",j)))
printf("%d",i);
else
printf("%d",j);
return 0;
}
As printf() returns the number of characters successfully printed, the condition will be if(1<1) which is false but the if part is executed and the output is 1 -1 1. W...
Hi everybody,
thanks for your support for solving my previous problems. Now I'm studying self referential structures. I have written the following code:
#include <stdio.h>
int main()
{
system("clear");
struct node
{
int x;
struct node *next;
} p1;
printf(" \nthe address of node1 = %u",& p1);
printf(" \n\nthe size of node 1 = %d",...
How do you use a string array as a parameter in C? If I were to write a function with signature:
Guess i didnt explain myself very well... I'll post the code that i'm trying to get to work.
int format_parameters(char* str) {
char local_str[201] = "";
int i = 0;
int j = 0;
int flip = 0;
while(str[i]) {
if(...
Edited to include short description of what is expected from the code.
#include <sys/file.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define MAX_PAGE 0xFF+1
/* page table entry you may need to add your own fields to it*/
typedef struct
{
unsigned short frame;/*location*/
unsigned int valid:1;
unsigned int in_mem:1;...
What are the things that can be done in C but not in C++, and which of these features do you miss the most while coding in C++?
Few things I can think of:
We can assign any type of pointer to void pointer without cast in c but not in c++.
Declare variable names that are keywords in C++ but not C ;)
EDIT : Thanks @sbi for pointing ...
As we know, in windows system, we can set locale language for non-Unicode programs in "Control Panel\Clock, Language, and Region". But what does a local language mean for an application? Since to my understanding, an application is a compiled binary executable file, which only contained machine code instructions and no data, so how the c...
for simple code ...example we plug the pen drive and detect it then find the space and check the contant..that it..
...
hi,
I have asked to write c program for HDMI EDID test cases in set top box....i am new to c programming..i dont know how to write c program for testing set top box which respond to all kind of resolution...that means the set top box have to convert the sourse signal resolution to display device resolution....if you know any small idea ...
I'm learning about linear congruential generator in an algorithms and data structures course. After thinking about RNG implementation we've been using (a=429493445, c=907633385, mod=4294967296, X is _uint32), one thing came to my mind: Program has a function for setting seed.
How important would that function be in C and C++?
Here's ...
#include<stdio.h>
int main(void)
{
int a=5;
printf("%d"+1,a);
}
Output: d.
I didn't get how the output is coming: d ?
...
Hello,
embedded system (kernel 2.4.20). In my driver I need to access ARP header fields, including MAC addresses; unfortunately in include/linux/if_arp.h those specific fields are commented . So I've tried to define my own 'arp_hdr' structure in my code with necessary fields:
struct arp_hdr {
/* all the fields taken from include/li...
I have a little (big, dumb?) question about int and chars in C. I rememeber from my studies that "chars are little integers and viceversa," and that's okay to me. If I need to use small numbers, the best way is to use a char type.
But in a code like this:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int ...
I have started reading the Lions Commentary on Unix v6. I came across these snippets, which I have never seen used in the C language. The author does provide some sort of an explanation, but could someone explain to me what is happening here?
params.h :
SW 0177570
......
struct { int integ; };
and this used in unix/prf.c
if(SW->int...
Possible Duplicate:
Confusion about the output..
#include<stdio.h>
void main()
{
int i=1,j=-1;
if(printf("%d",i)<printf("%d",j))
printf("%d",i);
else
printf("%d",j);
}
here in this program what is the output & how ?
...
I need to write my own memory allocation functions for the GMP library, since the default functions call abort() and leave no way I can think of to restore program flow after that occurs (I have calls to mpz_init all over the place, and how to handle the failure changes based upon what happened around that call). However, the documentati...
I want to add a C file into my .NET application.
How can I built this?
How can i write unmanaged code in C#.
Can someone explain with few lines code.
Thanks
...