or is it that we cant typecast structure to integer ???
Type: Posts; User: trish
or is it that we cant typecast structure to integer ???
but how is this possible .. i mean as far as i know structure variables are stored in contiguous memory locations .. or if not being in contiguous memory locations is the problem and NOTHING ELSE...
run 2 for loops one nested in another
outer 1 for height inner 1 for width ... read it as a byte in character .. use & operator .. negate it .
Hello everyone,
BitFields gives us the liberty to decide how many bits to allot for the particular field.
ex.
struct x
{
unsigned a:1;
unsigned b:2;
unsigned c:3;
so in 2D array is (arr+0) and *(arr+0) same ??
but even *(arr+0) returns the address of 0th 1 D array then how is it different from (arr+0) which according to you returns the address of 0th 1D array again as well ?? :O
say i have a 2D array
int arr[5][2] = {
{1,2},
{3,4},
{5,6},
{7,8},
{9,10} };
now if i say arr[0].. its internally treated as *(arr+0)
void main()
{
struct a
{
struct b
{
int i;
float f;
}x;
Thanks :)
Here is a code snippet :
int a[2][2] = {
{7, 12},
{2, 7}
};
printf("\n%u %u %u", a + 1, *(a + 1), a[1]);
I meant the human readable int * p as a normal pointer & the vague looking (int * p)[2] as the weird one :biggrin:
How exactly is a normal pointer any different from a pointer to an array ? Any array, even a multidimensional one, even when its sub arrays are extracted, would yield a base address...why can't a...
p = s[i] will work just fine & I am also aware of the syntax needed to access a particular element as pointed out. My question though, is about the statements commented out as alternatives 1 & 2 and...
Consider the following piece of code :
int s[4][2] = {
{1, 2},
{3, 4},
{5, 6},
{7, 8}
};
To be honest, I don't know how to do that :o but I will give it a try...but you do agree then that the output should be garbage ?
void main()
{
int * j = fun();
printf("%d", *j);
}
int * fun()
{
int k = 35;
Got it...Thanks a lot guys !
I still don't get it :o
These are 2 slightly different versions of a recursive program for factorial :-
int fact(int x)
{
if(x == 1)
return 1;
else
return x * fact(x--);
}
Agreed
I am sure your knowledge of the C programming language is far superior than mine but the condescending tone make you sound like a real jerk. I posted this question here because I had a...
The program is compiled using turbo c (I know ancient compiler & the usual shenanigans but...) & runs error free. The output is this :
Candidate 1 - itemsets
0 : I1
1 : I2
2 : I5
default :...
Hey !
Folks, need some help with a module that am writing...
I have a simple text file with transactions like these :
T100-I1,I2,I5
T200-I2,I4
T300-I2,I3
T400-I1,I2,I4
Never mind, figured out the first one as well...this one's got to be the most narcissist thread ever :D
I figured out the second problem i.e., the issue of the monster not being seen : had forgotten the call to grid function (similar to the one used for pacman)...<duh>
But, the first problem, that of...
I have gotten thus far in my pacman game in dos:
1) The maze rendered
2) The pacman moved in the maze (along with collision detection with the walls)
3) Pills swallowed by pacman & score...