Krishna iResearch Intelligent Cloud Platform - VIRtual Generic Os - VIRGO - Linux kernel extensions for cloud
Main Page
Classes
Files
File List
All
Classes
linux-kernel-extensions
virgo_malloc
test
intptrtest.c
1
/***************************************************************************************
2
VIRGO - VIRtual Generic Os - linux kernel extensions for cloud
3
4
This program is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
--------------------------------------------------------------------------------------------------
18
Copyright(C):
19
Srinivasan Kannan (alias) Ka.Shrinivaasan (alias) Shrinivas Kannan
20
Independent Open Source Developer, Researcher and Consultant
21
Ph: 9789346927, 9003082186, 9791165980
22
Open Source Products Profile(Krishna iResearch): http://sourceforge.net/users/ka_shrinivaasan
23
Personal website(research): https://sites.google.com/site/kuja27/
24
emails: ka.shrinivaasan@gmail.com, shrinivas.kannan@gmail.com, kashrinivaasan@live.com
25
--------------------------------------------------------------------------------------------------
26
27
*****************************************************************************************/
28
29
#include <stdio.h>
30
#include <stdlib.h>
31
#include <stdint.h>
32
33
struct
teststruct
34
{
35
int
i;
36
};
37
38
int
main()
39
{
40
struct
teststruct
*p3=(
struct
teststruct
*)malloc(
sizeof
(
struct
teststruct
));
41
intptr_t sptr=(intptr_t)(
void
*)p3;
42
int
i=245;
43
int
*p=&i;
44
intptr_t iptr=(intptr_t)(
void
*)p;
45
printf(
"iptr=%u,sptr=%u\n"
,iptr,sptr);
46
int
*p2=(
int
*)iptr;
47
struct
teststruct
*sptr2=(
struct
teststruct
*)sptr;
48
printf(
"p=%p, p2=%p, p3=%p,sptr2=%p\n"
,p,p2,p3,sptr);
49
unsigned
long
x=0xf1481400;
50
printf(
"x=%u, x=%x\n"
,x,x);
51
const
char
* sptr5=
"test string"
;
52
unsigned
long
sptr5ul=(
unsigned
long)sptr5;
53
char
* sptr6=(
char
*)sptr5ul;
54
printf(
"sptr6=%s\n"
,sptr6);
55
}
teststruct
Definition:
intptrtest.c:33
Generated on Tue Jul 15 2014 13:51:27 for Krishna iResearch Intelligent Cloud Platform - VIRtual Generic Os - VIRGO - Linux kernel extensions for cloud by
1.8.6