I have an array as:
int x[3][5]={
{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15}
};
What does *x refer to?
*(*x+2)+5 refer to "8".How does that happen?
Is *(*x+2) same as *(*x)+2?
What if I do:
*n=
Where is the pointer n pointing to? if it would have been only x and not an & then it would have been the...
I've implemented a basic filesystem using FUSE, with all foreseeable POSIX functionality implemented [naturally I haven't even profiled yet ;)]. Currently I'm able to run the filesystem on a regularly file, but the next step in development is to host it on an actual block device. Running my code as is, immediately fails on reading st_siz...
Hey!
i need to write a function that receives an array of pointers to functions.
i wrote the following code, however i'm having trouble in testing it at the moment.
is this the correct way to define a pointers to function array?
typedef (*Function)(double);
void func(Function* arr);
and if i want to declare the size of the array wit...
the following code:
signed char sc = ~0xFC;
unsigned char uc = ~0xFC;
when compiled gives me the following warnings:
integer conversion resulted in truncation
integer conversion resulted in truncation
why do i get these warnings
how do i write my code, so that i dont get these warnings (without using #pragmas)
thanx,
i'm using ...
This is an add-on to another question found here.
In short: I would like to list all of the open files on a system and retrieve their associated file names. If this is the wrong approach, or if there's another way, please give me a push in the right direction. Or, if I'm missing any details or something's unclear, please yell at me.
...
The structure defined below does not have a structure name. Moreover I am unable to get the array part. Thanks in advance.
What does the values in the array of structure mean?
#include <stdio.h>
int main()
{
struct
{
int x,y;
} s[] = {10,20,15,25,8,75,6,2};
int *i;
i = s;
clrscr();
printf("%d\n",*(i+...
When a function returns, is the memory allocated via malloc freed? Or can it still be accessed in the main() function using pointers?
eg.
void function(int *a)
{
a=(int *)malloc(sizeof(int));
*a=10;
}
int main()
{
int *num;
function(num);
printf("%d",*num);
return(0);
}
Can the integer stored in a be accessed ...
Summary:
I have a struct that is read/written to file.
This struct changes frequently, and this causes my read() function to get complex.
I need to find a good way to handle change while keeping the bug count low.
Optimally, code should be make it easy for one to spot the changes between versions.
I have thought through a couple of pa...
I came across the following code, and was told that it means that COL_8888_RED is "endian independent". Why? What makes this endian independent?
(I have asked the original coder but they're not getting back to me ... heck maybe they don't know either.)
union _colours {
uint8 c[3][4];
uint32 alignment;
};
static const union _co...
I'm looking for informations about how to make a coding dojo for embedded. More especific with C Ansi and also with Assembly, if possible.
...
I thought that I was really starting to understand how pointers work, and then I came across this exercise. I was trying to recreate a chunk of code that I found in my 'Learn C' book and I got it done and it was working and I thought everything was great:
void PrintWords( char *line ) {
bool inWord = false;
while (*line != kB...
I can fill a TreeView control with particular Registry keys by enumerating registry keys recursively and put them in the TreeView control; then for performance reason, I attempt to
use a nonrecursive/iterative approach to enumerate registry keys, but how can I fill the TreeView since a "tree" is naturally recursive (at least, in my under...
Possible Duplicate:
What is the best IDE for C Development / Why use Emacs over an IDE?
I'm looking for a C IDE that I can use for my Computer Science class. An ideal IDE would feature a built-in compiler and debugger within the program, as Eclipse for Java, or Visual Studio for C#, already do.
Do any such IDEs exist, or am I...
I was reverse engineering some code and came across this...
/************************************************************************/
/* */
/* MACRO CHECK_FREAD */
/* ...
So original SLN compiled. I tried it, it worked. But when I am triing to compile it under \clr (which is critical for me). So what I tried was to try playing with compiler options but after fixing general visiable errors I ended with this 3
Error 10 error LNK2028: unresolved token (0A0003BF) "extern "C" int __cdecl _CrtDbgReportW(in...
Reverse engineering code and I'm kind of appalled at the style, but I wanted to make sure there's no good reason for doing these things....
Is it just me or is this a horrible coding style
if ( pwbuf ) sprintf(username,"%s",pwbuf->pw_name);
else sprintf(username,"%d",user_id);
And why wrap code not intended for compilation in an
#if...
I need to kill such user processes that are taking longer time than a said expected interval on UNIX (Solaris) operating system. This needs to be done inside the process that is currently being executed.
Please suggest how this can be achieved in C or in UNIX?
...
I work on a third party language product which does dynamic binding via ODBC and a customer is wanting to be able to insert bound variables without a field list, i.e. INSERT INTO table VALUES (values), not INSERT INTO table (columns) VALUES (values). The problem is that in the former case for SQLServer bind variables, the AUTO_INCREMENT...
I have made the following linked list which is not printing the list .The printrecord funtion is not working.Sorry for the long code.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct student
{
char *name;
int roll_no;
struct student *ptr_next;
}*ptr_this,*ptr_first;
void PrintMenu(v...
I am trying to receive characters from an Arduino board on linux, but this library returns no characters. The code:
#include "rs232.h"
#include <time.h>
#include <stdio.h>
void main() {
int res = OpenComport(16, 9600);
printf("Open port result: %d\n\n\n", res);
unsigned char *buf;
while(1) {
int n = PollCompor...