[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] char til int



On Tue, 14 Jan 2003 sslug@sslug wrote:

> Hvordan kan jeg convertere enkelte char i et char-array til integers
> (0 eller 1)?

#include <stdio.h>
void insert_int(int i) {
        printf("Bit: %d\n", i);
}
int main(void) {
        char *s = "01100";
        while (*s)
                insert_int(*s++ % 2);
        return 0;
}

> -Eller kan man erklære et bit-array i c?

struct test {
	unsigned bit0_0 : 1; /* fylder 1 bit */
	unsigned bit1_3 : 3; /* fylder 3 bit */
}

men den kan du vist ikke bruge til noget.

mvh/hans
-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
In Linux® we have found a UNIX® that is a better answer. We
think Linux® is the new UNIX®.	-- Michael Dell



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *