Posts

Image
"Educating the mind without educating the heart is no education at all." - Aristotle Once a thief, always a thief. ~ American Proverb When glory comes, loss of memory follows. A diamond with a flaw is better than a common stone that is perfect. Everyone's friend is often everyone's foot. "A man is known by the company he keeps." - Our character is reflected in our choice of friends "Don’t put all your eggs in one basket." - Don’t make everything dependent on one thing - Don’t put all your resources into one thing - Don’t depend for your success on a single plan - Don’t concentrate all efforts into one area "When the cat's away, the mice will play." - Without supervision, people will do as they please, especially in disregarding or breaking rules. "Two boys are half a boy, and three boys are no boy at all."- The more boys that help, the less work they do. ...

Reverse string without using temp

#include <stdio.h> #include <string.h> void reverse(char *, int start, int end); int main(int argc, char **argv) {         if (sizeof(argv) > 1) {                 printf ("Given string :%s\n", *++argv);                 reverse(*argv, 0, strlen(*argv) - 1);                 printf ("String after reverse : %s\n", *argv);         }         return 0; } void reverse(char *str, int start, int end) {         if (start < end) {                 str[start] = str[start] + str[end];                 str[end] = str[start] - str[end];                 str[start] = str[start] - str[end];         } else ret...

Reverse string using recursion

#include <stdio.h> #include <string.h> void reverse(char str[], int, int); int main() {         int size = 0;         char str[20];         printf ("Enter the your string \n");         scanf ("%s", str);         size = strlen(str);         reverse(str, 0, size - 1);         printf ("String after reverse : %s\n", str);         return 0; } void reverse(char str[], int index, int size) {         char temp;         temp = str[index];         str[index] = str[size - index];         str[size - index] = temp;         if (index == (size / 2)) {                 return;         }         ...

String Reverse using temp

#include <stdio.h> #include <string.h> int main() {         char str[20];         char temp;         int i = 0;         int j = 0;         int strlength = 0;         printf ("Enter string to reverse ");         scanf ("%s", str);         strlength = strlen(str);         for (i = 0, j = strlength - 1; i < strlength / 2; i++, j--) {                 temp = str[i];                 str[i] = str[j];                 str[j] = temp;         }         printf (" Reversed string is : %s\n", str);         return 0; }

Passing value from a.out

#include <stdio.h> int main(int argc, char **argv) {         printf ("*argv : %s\n", *argv);         printf ("*++argv :   %s\n", *++argv);         printf ("*argv : %s \n", *argv);         printf ("argv[0] : %s \n", argv[0]);         printf ("**argv : %c \n", **argv);         return 0; }                                         Output :  $ ./a.out chethan mandya *argv : ./a.out *++argv :   chethan *argv : chethan   argv[0] : chethan   **argv : c  

Linux Commands

1. sudo This SuperUserDo is the most important command Linux newbies will use. Every single command that needs root's permission, need this sudo command. You can use sudo before each command that requires root permissions - $ sudo su 2. ls (list) Just like the other, you often want to see anything in your directory. With list command, the terminal will show you all the files and folders of the directory that you're working in. Let's say I'm in the /home folder and I want to see the directories & files in /home. /home$ ls ls in /home returns the following - imad lost+found 3. cd ​Changing directory (cd) is the main command that always be in use in terminal. It's one of the most Linux basic commands. Using this is easy. Just type the name of the folder you want to go in from your current directory. If you want to go up just do it by giving double dots (..) as the parameter. ​ Let's say I'm in /home directory and I want to move in usr directory which is al...

Resource not found exception in Roboeletric

Image