Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Beginner....Decimal/Octal converter help Date: Tue, 13 Sep 2022 15:40:38 -0700 Organization: A noiseless patient Spider Lines: 41 Message-ID: <86o7vioq3d.fsf@linuxsc.com> References: <8ffd982c-2e82-4caa-9256-ec17be2efe56n@googlegroups.com> <86leqsr091.fsf@linuxsc.com> <86zgf6ovhd.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader01.eternal-september.org; posting-host="e4a07c6eb40a7dcf36ed28254bbf399a"; logging-data="2837108"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LOnt5d2TR7EwA0n/9fZw95m0Xt+y+Izc=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:6lcgGDInb16zByHXrfMZEamhQj4= sha1:AiWJNA5F6C91VkKlKxk+YaJMtWc= Xref: csiph.com comp.lang.c:167685 scott@slp53.sl.home (Scott Lurndal) writes: > Tim Rentsch writes: > >> scott@slp53.sl.home (Scott Lurndal) writes: >> >>> Tim Rentsch writes: >>> >>>> ManyBeers writes: >>>> >>>>> Hello I am teaching myself C and I need some help with a problem. >>>>> After a search for dec/oct convert I found this code: >>>>> >>>>> [..code..] >>>> >>>> I would like to offer a different kind of answer to your >>>> questions. First a suggestion: for this kind of problem I think >>>> you will find it helpful to use unsigned types exclusively. In >>>> the code below we will need (besides a plain 'unsigned' here and >>>> there) two types, one for 8-bit values and one for 32-bit values > > : > >>>> typedef unsigned char UC; >>>> typedef unsigned int UI; >>> >>> There already standard perfectly cromulent typedefs for both, >>> uint8_t and uint32_t. >> >> For the posted response and example I think unsigned {char,int} >> are better suited. > > You said, and I quote: > > "two types, one for 8-bit values and one for 32-bit values Yes, and I also said "unsigned {char,int} are better suited" for the posted response and example. The quoted phrase was put in to provide non-restrictive information about the two types being used, and not to give a specification for those types, which were given elsewhere in the posting.