Sponsored Content
Full Discussion: atoi
Top Forums Programming atoi Post 101567 by jim mcnamara on Thursday 9th of March 2006 05:28:18 PM
Old 03-09-2006
The standard for atoi is to read along a string from a given starting point until it encounters a space, a nul, or a non-numeric character. "name" starts with an "n" which is non-numeric. atoi is finsihed before it starts. By definition, atoi returns 0 in that case.
 

2 More Discussions You Might Find Interesting

1. Programming

help with atoi and macros in C

I have a PORT_NUM macro (10 digits long number) in a server file, if i do htons(PORT_NUM) i get warning: this decimal constant is unsigned only in ISO C90 warning: large integer implicitly truncated to unsigned type whats wrong with this? (2 Replies)
Discussion started by: omega666
2 Replies

2. Programming

type conversion C, atoi()

In the book "The C programming language"; second edition, chapter 2.7 there is a snippet which is supposed to: "convert a string of digits into its numeric equivalent". int atoi(char s) { int i, n; n = 0; for ( i = 0; s >= '0' && s <= '9'; ++i) n = 10 * n + (s -... (4 Replies)
Discussion started by: tornow
4 Replies
All times are GMT -4. The time now is 07:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy