C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays structures functions recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Armstrong Fibonacci series factorial palindrome code programs examples on c++ tutorials and pdf
i think.. we can take the size of result array not same as the greatest number sized.. instead take it greatest number size +1. here in this case we can take 256 size for result array.. then there will not be wrong out put in case of carry..
Yeah... this is kind of a nice code, but there's this minor mistake you're mentioning and the fact that it uses static allocation for those arrays, which is not quite smart. It's easy to modify it though, and use the argc/argv declaration of the main function to dynamically allocate the arrays. Then the only restriction to the length of the input would be your system's stack size ;)
4 comments:
wenever numbers r unequal n der is a carry d output is incorrect
eg : 9+9999
i think..
we can take the size of result array not same as the greatest number sized.. instead take it greatest number size +1.
here in this case we can take 256 size for result array..
then there will not be wrong out put in case of carry..
i dont think so. ac and bc were positioned nicely, and algorithm is working backwards.. and copying the excess..
Yeah... this is kind of a nice code, but there's this minor mistake you're mentioning and the fact that it uses static allocation for those arrays, which is not quite smart. It's easy to modify it though, and use the argc/argv declaration of the main function to dynamically allocate the arrays. Then the only restriction to the length of the input would be your system's stack size ;)
Post a Comment