Topic profile page for Sizeof.
This page has aggregated data from forum posts, threads, listings, online discussions, newsgroups, messageboards, and other online sources which contain user generated content for the term: Sizeof.
Topic "Sizeof" was discussed 8,318 times on 401 sites in last 3 months
Started 3 days, 16 hours ago (2009-11-26 22:06:00)
by nkrao123@gmail.
" The sizeof('x') constants do not return expected results. In C, the return value is 4 for the sizeof character constant and 2 for the sizeof multicharacter constant " i got output for 4 for printf("%d ",sizeof('x'); .but i am not understand how output 2 for this statement "2 for the sizeof multicharacter constant ". please give any one example for this output 2
Started 4 days, 10 hours ago (2009-11-26 04:18:00)
by Nidhin KR
Hi Team, I am using sizeof() in c# I need to find the memory size required by the array which is of the type strut. Please see the snippet. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Globalization; namespace sizeOfDemo { struct Vertex { public float r; public float g; public float b; public ...
Started 4 days, 14 hours ago (2009-11-26 00:28:00)
by nkrao123@gmail.
Code: int main() { char ch='a'; printf("%d ",sizeof(ch)); printf("%d ",sizeof('a')); return 0; } ouput 1 4 i am littlebit confusing on the output of sizeof('a') is 4. can you clear my confusion?
Started 2 weeks, 4 days ago (2009-11-12 03:10:00)
by Julia Lawall
( From: Julia Lawall As observed by Joe Perches, sizeof of a constant string includes the trailing 0. If what is wanted is to check the initial characters of another string, this trailing 0 should not be taken into account. If an exact match is wanted, strcmp should be used instead. The semantic patch that makes this change is as follows: \(http://coccinelle....
Started 2 weeks, 5 days ago (2009-11-10 19:42:00)
by Ploe
I'm trying to get to grips with malloc however the sizeof function - no matter what I do, always returns 4. Can someone explain to me what is up? Code: #include #include int main() { int *ptr = malloc(sizeof(int) * 10); int len = sizeof(ptr); printf("Len: %i", len); }
Started 1 month, 1 week ago (2009-10-17 16:41:00)
by hugo2x
I was wondering if there was a way to makea function, that like the sizeof() function returning the byte number, it returns the bit number? Code: //for example printf("%d bytes",sizeof(int)); //prints 4 bytes Code: // I want to make a function modification, or a new function that prints amount of bits printf("%d bits",sizeofbits(int)); //a new functions //prints 32...
Started 3 days, 20 hours ago (2009-11-26 18:22:00)
by Windows Programmer
From a Windows CE 6.0 user mode process, I'm trying to get information about kernel memory using VirtualQueryEx(). The code goes something like this: hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pidOfNKdotEXE); if (hProc) { rc = VirtualQueryEx(hProc, 0xd0000000, &mbi, sizeof(mbi))...
Started 3 days, 20 hours ago (2009-11-26 18:22:00)
by Windows Programmer
From a Windows CE 6.0 user mode process, I'm trying to get information about kernel memory using VirtualQueryEx(). The code goes something like this: hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pidOfNKdotEXE); if (hProc) { rc = VirtualQueryEx(hProc, 0xd0000000, &mbi, sizeof(mbi))...
Started 1 week ago (2009-11-22 22:19:00)
by tyftyftyf
Hi, I allocated a struct from a heap, the struct may be like this one: struct abc{ int tmp1; string tmp2; int tmp3; }*pabc; pabc=(abc*)malloc(sizeof abc); And when I initialize the string(pabc-> tmp2="1234"), an "Illegal Pointer" exception occured. It seems that the size of the string is changed, so I decided to allocate a bigger size. pabc=(abc*)malloc(sizeof abc+4); But the error still ...
Started 5 days, 21 hours ago (2009-11-24 17:06:00)
by Anthony Appleyard
I know well how to ask the user to choose a file: BOOL GetFileName(HWND wn,char*file,char*t,char*f,short write/*=1*/) {short j; strcpy(file,tit); ofn.lStructSize=sizeof(OPENFILENAME); ofn.hwndOwner=wn; ofn.lpstrFilter=f; ofn.lpstrCustomFilter=0; ofn.lpstrFile=file; ofn.nMaxFile=128; ofn.lpstrFileTitle=tit; ofn.nMaxFileTitle=256; ofn.lpstrInitialDir=0; ofn.lpstrTitle=t; ofn.Flags=write?OFN_...
Started 3 days, 23 hours ago (2009-11-26 15:41:00)
by sDoky
Hi, I am writing a program in C, which should work with matrixes. I want to have dynamic array within a structure. Something like this: Code: Select all typedef struct input { int x; int y; int array[][]=malloc(x*y*sizeof(int)); } Tinput; Because first two values I am gonna load is a size of the matrix, then I should be able to load the matrix correctly. I do not know how to put it there...
Started 6 days, 11 hours ago (2009-11-24 03:34:00)
by opriyer
Hello, Here is a sample code that is giving problems: while ( true ) { readBufPtr = fgets (buf, sizeof(buf), stdin); if (readBufPtr) syslog (LOG_INFO, buf); else if (EINTR != errno) { syslog (LOG_ERR, "[ESReadStdin] read from stdin failed. Reason: [%s]. Exiting." , strerror (errno)); exit(-1); } } The fgets call gives the ...
Started 3 days, 20 hours ago (2009-11-26 18:22:00)
by Windows Programmer
From a Windows CE 6.0 user mode process, I'm trying to get information about kernel memory using VirtualQueryEx(). The code goes something like this: hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pidOfNKdotEXE); if (hProc) { rc = VirtualQueryEx(hProc, 0xd0000000, &mbi, sizeof(mbi))...
Started 2 days, 22 hours ago (2009-11-27 16:16:00)
by Arzar
Citation: Envoyé par camboui std::string n'est pas POD alors. Et toute structure contenant des std::string ne l'est pas non plus. Comme tu dis les PODs sont donc des struct "C like". Je me demande dans quel cas ça peut-être utile ce genre d'info. Par exemple dans la STL de VS ou celle de GCC un appel à std::...