LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-03-2005, 09:33 PM   #1
rajesh_b
Member
 
Registered: Sep 2004
Location: Hyderabad.
Posts: 83

Rep: Reputation: 15
Doubts in c


Hi,

I have came across these following questions in some website. But i dont know the answers for those... Actually these are the interview questions asked in sun microsystems.

The questions are

1.How do you know my machine(CPU) is 64 bit or 32 bit
without use of sizeof oerator?



2. What do u mean by malloc(***)?



3. How can we know whether kernel has support for threading?


Can any body tell me what are the answers for those?

Thankx in advance,
Rajesh.
 
Old 06-03-2005, 11:32 PM   #2
MoneyCat
LQ Newbie
 
Registered: Jun 2005
Location: USA
Distribution: Ubuntu 5.04
Posts: 10

Rep: Reputation: 0
Quote:
1. How do you know my machine(CPU) is 64 bit or 32 bit without use of sizeof oerator?
Code:
#include <stdio.h>

int main()
{
     char *c = (char*)0x100000000;       // 4Gb
     c++;

     if(&*c > 0)
        printf("machine is 64bit\n");
     else
        printf("machine is 32bit\n");

     return 0;
}
Quote:
2. What do u mean by malloc(***)?
The syntax does not seem to conform to the ANSI/ISO Standard C.



Good luck

Last edited by MoneyCat; 10-30-2005 at 01:12 AM.
 
Old 06-06-2005, 10:54 PM   #3
rajesh_b
Member
 
Registered: Sep 2004
Location: Hyderabad.
Posts: 83

Original Poster
Rep: Reputation: 15
Can u explain the code

Hi MoneyCat,

Thanx for ur reply.
Even though i m getting little warnings, the program is working fine. But i am not able to understand the code. Can u please explain the code little bit. Waiting for ur reply.



Rajesh.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NAT doubts vermaamitabh Linux - Networking 2 10-29-2004 10:11 AM
script doubts praveenv Linux - Newbie 1 08-14-2004 08:00 AM
Makefile doubts varala_kanth Linux - Software 0 03-25-2004 11:15 PM
slackware doubts ;-| sridharinfinity Slackware 6 10-25-2003 02:18 PM
cd playing doubts! zaba Linux - Software 0 10-05-2003 10:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration