Sponsored Content
Top Forums UNIX for Advanced & Expert Users What is the Maximum number of characters that i can store in a variable? Post 53751 by photon on Friday 23rd of July 2004 04:02:40 PM
Old 07-23-2004
By character you mean ASCII character?

8 bits or byte can hold 256 possible values (2^8=256)

C char is 1 byte
C undigned char 1 byte
so then...
C short int 2 bytes
C unsigned short int 2 bytes
C (long) int 4 bytes
C float 4 bytes
C double 8 bytes
In Java byte

By character you mean UCS-2?
16 bits
C short int
C int (sometimes)
Java char and Java short int

By character you mean UCS-4
32 bits
C int (usual)
C long int
Java int

64 bits longword or quadword
C long int (on 64 bit machine)
Java long int

Sometimes it depends on your machine

To allocate space to hold 14 int's

int *ip = malloc(14 * sizeof(int));

whould make room for 14 integers depending on your machine.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Maximum number of threads per user

Anybody knows how to setup Maximum number of threads per user or some other value on Sun Solaris 8. (1 Reply)
Discussion started by: s_aamir
1 Replies

2. Shell Programming and Scripting

Line with maximum no . of characters

Hey , I want to check the row in a file with maximum characters . the output sud contain that row number along with the no of characters. (4 Replies)
Discussion started by: mohapatra
4 Replies

3. UNIX and Linux Applications

handling maximum number characters in an input file

Hi, Can anyone help me? An input file has three lines. Each line should only be 2098 as number of characters however line 2 of the input file has more than the maximum number of characters, it exceeded up to 4098. What should I do so that could handle maximum number of characters? that it could... (1 Reply)
Discussion started by: chrysSty
1 Replies

4. UNIX for Dummies Questions & Answers

maximum number of arguments

Hi, What is the maximum number of arguments that could be passed to zsh ? To find out that I tried a simple script. And the maximum number of arguments that could be passed turned out to be 23394 #! /bin/zsh arg=1 i=1 subIndex=23000 while do arg=$arg" "$i i=$(($i + 1))... (9 Replies)
Discussion started by: matrixmadhan
9 Replies

5. UNIX for Dummies Questions & Answers

ls - maximum number of files

what is the maximum number ls can list down (6 Replies)
Discussion started by: karnan
6 Replies

6. Shell Programming and Scripting

Capturing a number at the end of line and store it as variable

Hello, Would someone guide me on how to write a shell script the would search for a phone no using at the end text file using sed or awk and store it in a varaible or print it. The text file is in this form text or numbers in first line text or numbers in second line . . . Firsname... (6 Replies)
Discussion started by: amuthiga
6 Replies

7. UNIX for Dummies Questions & Answers

Using GREP/AWK to extract a number and store it as a variable

Hello, I have a question regarding the awk command. Here is the line I need to grep: 1 F= -.13250138E+03 E0= -.13249556E+03 d E =-.174650E-01 mag= 35.2157 Instead of displaying the number in red I would like to store it as a variable such as X. Is there a way to do this? Thanks for any... (3 Replies)
Discussion started by: modey3
3 Replies

8. Shell Programming and Scripting

Maximum number of characters in a line.

Hi, Could any one please let me know what is the maximum number of characters that will fit into a single line of a flat file on a unix. Thanks. (1 Reply)
Discussion started by: Shivdatta
1 Replies

9. Shell Programming and Scripting

Maximum number from input by user

I am trying to calculate the maximum number from four numbers input by the user. I have the following code, but it does not work. It says there's an error with the last line "done". Any help would be appreciated. max=0 echo "Please enter four numbers: " for i in 1 2 3 4 do read number... (17 Replies)
Discussion started by: itech4814
17 Replies
OUTB(2) 						     Linux Programmer's Manual							   OUTB(2)

NAME
outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O SYNOPSIS
#include <sys/io.h> unsigned char inb(unsigned short int port); unsigned char inb_p(unsigned short int port); unsigned short int inw(unsigned short int port); unsigned short int inw_p(unsigned short int port); unsigned int inl(unsigned short int port); unsigned int inl_p(unsigned short int port); void outb(unsigned char value, unsigned short int port); void outb_p(unsigned char value, unsigned short int port); void outw(unsigned short int value, unsigned short int port); void outw_p(unsigned short int value, unsigned short int port); void outl(unsigned int value, unsigned short int port); void outl_p(unsigned int value, unsigned short int port); void insb(unsigned short int port, void *addr, unsigned long int count); void insw(unsigned short int port, void *addr, unsigned long int count); void insl(unsigned short int port, void *addr, unsigned long int count); void outsb(unsigned short int port, const void *addr, unsigned long int count); void outsw(unsigned short int port, const void *addr, unsigned long int count); void outsl(unsigned short int port, const void *addr, unsigned long int count); DESCRIPTION
This family of functions is used to do low-level port input and output. The out* functions do port output, the in* functions do port input; the b-suffix functions are byte-width and the w-suffix functions word-width; the _p-suffix functions pause until the I/O completes. They are primarily designed for internal kernel use, but can be used from user space. You must compile with -O or -O2 or similar. The functions are defined as inline macros, and will not be substituted in without optimiza- tion enabled, causing unresolved references at link time. You use ioperm(2) or alternatively iopl(2) to tell the kernel to allow the user space application to access the I/O ports in question. Failure to do this will cause the application to receive a segmentation fault. CONFORMING TO
outb() and friends are hardware-specific. The value argument is passed first and the port argument is passed second, which is the opposite order from most DOS implementations. SEE ALSO
ioperm(2), iopl(2) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2012-12-31 OUTB(2)
All times are GMT -4. The time now is 03:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy