Better HN
topnewbestaskshowjobs
Log inSign up

gregzav

2 karma · joined Jan 25, 2011 (15y ago) · 3 submissions

software engineer @ pandora
Submissions

comment 15y ago · link · parent

Works for me from the UK

comment 15y ago · link · parent

Selling my Microsoft shares... Bought them a year ago thinking they could at least make one step in the right direction.

comment 15y ago · link · parent

I'm a Java person, but I forced myself to implement it in C.

  #include <stdio.h>
  
  int main() {
  	int integer = -1231232342;
  	int negative = integer < 0 ? -1 : 1;
  	integer = integer * negative;
  	char c[11];
  	int index = 0;
  	while(integer != 0) {
  		int position = integer % 10;
  		c[index++] = 48 + position;
  		integer = integer / 10;
  	}
  	if(negative == -1)
  		c[index++] = '-';
  	int swap = 0;
  	while(swap < index / 2) {
  		char t = c[swap];
  		c[swap] = c[index - swap - 1];
  		c[index - swap++ - 1] = t;
  	}
  	printf("%s\n", c);
  	return 10;
  }