View all courses
This Course is designed for the aspiring Web Designers and Developers with a need to understand the HTML in enough detail along with its simple overview, and practical examples.
Read more
CSS is used to control the style of a web document in a simple and easy way.This tutorial will help both students as well as professionals who want to make their websites.
JavaScript is a lightweight, interpreted programming language. It is designed for creating network-centric applications. It is complimentary to and integrated with Java.
This tutorial is designed for software programmers who wants to learn the basics of jQuery and its programming concepts in simple and easy ways. This tutorial will give you enough understanding on components of jQuery with suitable examples.
AJAX, is a web development technique for creating interactive web applications. If you know JavaScript, HTML, CSS, and XML, then you need to spend just one hour to start with AJAX.
HTML5 is the latest and most enhanced version of HTML.Technically, HTML is not a programming language, but rather a mark up language.This tutorial has been designed for beginners in HTML5 providing the basic to advanced concepts of the subject.
PHP (Hypertext Preprocessor), it is extensively used by developers for programming and development. PHP has lots of benefits and easy to learn so it is the first choice of developers and programmer.
Many PHP programming courses cover the basics or a specific concept. Our Advanced PHP Development course gives you the concepts, features, tools, and practical advice to use them together to build performant, secure, scalable, and reliable web applications.
In this tutorial we will provide you with detailed instructions on how to use WordPress to create and manage your site. WordPress can be used for both simple and complex websites. In our WordPress tutorial we have tried to cover all the basics and few advanced topics.
This tutorial has been prepared for developers who would like to learn the art of developing websites using CodeIgniter. It provides a complete understanding of this framework.
Zend Framework 1 is an open source framework for developing web applications and services using PHP 5.3+. Zend Framework 1 uses 100% object-oriented code and utilises most of the new features of PHP 5.3.
Zend Framework 2 is an open source Module based framework for developing web applications and services using PHP 5.5+. Zend Framework 1 uses 100% object-oriented code and utilises most of the new features of PHP 5.5
The Language Which does not need any prior knowledge of Programming and Easy to learn .Python is Object-oriented ,interpreted and Server side Scripting language .
In Advance concept After learning Core Python We will use Python to create Desktop Application, Web Application, Sockets Programming , Multithread Programming. Since its An Open source Language its free of Cost
Ruby is server side, dynamic, reflective, object-oriented, general-purpose programming language. Ruby is "an interpreted scripting language for quick and easy object-oriented programming"
Ruby on Rails, or simply Rails, is a web application frameworkwritten in Ruby under the MIT License. Rails is a model–view–controller (MVC) framework, providing default structures for a database, a web service, and web pages.
If you have any confusion then you can ask our experts.Our experts will guide you properly.
We are looking you if you are looking guidance for web design and development. Apply online.
Contact us
< 20 Advanced Pointer Questions with Solutions in C Pointer Arithmetic in C >
10 Advanced Coding Problems On String Pointers in C 1. Remove Duplicate Characters (In-Place using Pointers) Problem: Remove duplicate characters from a string without using extra array. Code: #include <stdio.h> void removeDuplicates(char *str) { char *p1 = str; while (*p1) { char *p2 = p1 + 1; char *p3 = p1 + 1; while (*p2) { if (*p1 != *p2) { *p3 = *p2; p3++; } p2++; } *p3 = '\0'; p1++; } }
int main() { char str[] = "programming"; removeDuplicates(str); printf("%s", str); } Output: progamin
2. Check if Two Strings are Anagrams (Using Pointers) Problem: Check if two strings are anagrams without using sorting. Code: #include <stdio.h> int isAnagram(char *s1, char *s2) { int count[256] = {0}; while (*s1) count[*s1++]++; while (*s2) count[*s2++]--; for (int i = 0; i < 256; i++) { if (count[i] != 0) return 0; } return 1; } int main() { char s1[] = "listen"; char s2[] = "silent"; if (isAnagram(s1, s2)) printf("Anagram"); else printf("Not Anagram"); } Output: Anagram 3. Longest Word in a String (Pointer Traversal) Problem: Find the longest word using only pointers. Code: #include <stdio.h> void longestWord(char *str) { int maxLen = 0, currLen = 0; char *maxStart, *currStart; while (*str) { if (*str != ' ') { if (currLen == 0) currStart = str; currLen++; } else { if (currLen > maxLen) { maxLen = currLen; maxStart = currStart; } currLen = 0; } str++; } if (currLen > maxLen) { maxLen = currLen; maxStart = currStart; } for (int i = 0; i < maxLen; i++) printf("%c", *(maxStart + i)); } int main() { char str[] = "C programming is powerful"; longestWord(str); } Output: Programming In normal #include<stdio.h> int main(){ char mystring[]="c is an programming language"; int length=0,count=0,largestWordlength=0,wordIndex=0,i; while(mystring[length]!='\0'){ length++; } for(i=0;i<=length;i++){ if(mystring[i]==' '|| mystring[i]=='\0'){ if(largestWordlength < count){ largestWordlength = count; wordIndex=i; } printf("%d \n",count); count=0; }else{ count++; } } printf("Largest word index %d and length %d\n",wordIndex,largestWordlength); int start= wordIndex-largestWordlength; printf("%d \n",start); for(i=start;i<wordIndex;i++){ printf("%c",mystring[i]); } } Output 1 2 2 11 8 Largest word index 19 and length 11 8 programming 4. Reverse Words in a Sentence (In-Place) Problem: Reverse each word of a sentence using pointers. Code: #include <stdio.h> void reverse(char *start, char *end) { while (start < end) { char temp = *start; *start = *end; *end = temp; start++; end--; } }
void reverseWords(char *str) { char *start = str; while (*str) { if (*str == ' ') { reverse(start, str - 1); start = str + 1; } str++; } reverse(start, str - 1); } int main() { char str[] = "hello world"; reverseWords(str); printf("%s", str); } Output: olleh dlrow 5. Implement strstr() (Substring Search using Pointer) Problem: Find first occurrence of substring in a string. Code: #include <stdio.h> char* myStrstr(char *str, char *sub) { char *p, *q; while (*str) { p = str; q = sub; while (*p && *q && *p == *q) { p++; q++; } if (*q == '\0') return str; str++; } return NULL; } int main() { char str[] = "hello world"; char sub[] = "world"; char *res = myStrstr(str, sub); if (res) printf("%s", res); else printf("Not found"); } Output: world 6. Check if String is Rotation of Another Problem: Check if s2 is rotation of s1. Idea: Concatenate s1 + s1 Check if s2 is substring In normal #include <stdio.h> #include <string.h> int isRotation(char str1[], char str2[]) { int len1 = strlen(str1); int len2 = strlen(str2); // Step 1: Length must be equal if (len1 != len2) return 0; // Step 2: Create a new string (str1 + str1) char temp[2 * len1 + 1]; strcpy(temp, str1); strcat(temp, str1); // Step 3: Check if str2 is substring of temp if (strstr(temp, str2) != NULL) return 1; return 0; } int main() { char str1[] = "ABCD"; char str2[] = "CDAB"; if (isRotation(str1, str2)) printf("Rotation\n"); else printf("Not Rotation\n"); return 0; } Using pointer Code: #include <stdio.h> #include <string.h> int isRotation(char *s1, char *s2) { char temp[200]; strcpy(temp, s1); strcat(temp, s1); return strstr(temp, s2) != NULL; } 7. Compress String (Run-Length Encoding) Problem: Convert "aaabbc" → "a3b2c1" Code: In Normal #include<stdio.h> int main(){ char str[]="aaaabbbbttx"; int i,count; for(i=0;str[i] != '\0';i++){ count=1; while(str[i] == str[i+1]){ count++; i++; } printf("%c%d",str[i],count); } }
Using Pointer #include <stdio.h> void compress(char *str) { char result[100]; int i = 0, j = 0; while (str[i]) { char ch = str[i]; int count = 0; while (str[i] == ch) { count++; i++; } result[j++] = ch; result[j++] = count + '0'; } result[j] = '\0'; printf("%s", result); } Output: a3b2c1
In Java
import java.util.Scanner; public class RLECompression { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter a string: "); String str = sc.next(); for (int i = 0; i < str.length(); i++) { int count = 1; // Count consecutive characters while (i < str.length() - 1 && str.charAt(i) == str.charAt(i + 1)) { count++; i++; } // Print compressed output System.out.print(str.charAt(i) + "" + count); } sc.close(); } } 8. First Non-Repeating Character Problem: Find first non-repeating character using pointers. Code: #include <stdio.h> char firstUnique(char *str) { int count[256] = {0}; char *p = str; while (*p) count[*p++]++; p = str; while (*p) { if (count[*p] == 1) return *p; p++; } return '\0'; } 9. Remove All Occurrences of a Character Problem: Remove all 'a' from string using pointers. In Normal #include <stdio.h> void removeChar(char str[], char ch) { int i = 0, j = 0; while (str[i] != '\0') { if (str[i] != ch) { str[j] = str[i]; j++; } i++; } str[j] = '\0'; // terminate new string } int main() { char str[] = "programming"; char ch = 'g'; removeChar(str, ch); printf("Updated string: %s\n", str); return 0; } Using Pointer Code: void removeChar(char *str, char ch) { char *src = str, *dest = str; while (*src) { if (*src != ch) *dest++ = *src; src++; } *dest = '\0'; } 10. Palindrome Check using Pointers Problem: Check if string is palindrome using two pointers. Code: #include<stdio.h> int main(){ char mystring[]= "madixdam"; char *p = mystring; int l=0; while(*p != '\0'){ p++; l++; } char *start = &mystring[0]; char *end = &mystring[l-1]; int ispalendrome=1; for(int i=0;i<l/2;i++){ if(*start != *end){ ispalendrome =0; break; } start++; end--; } if(ispalendrome ==1){ printf("Plendrome"); }else{ printf("Not Plendrome"); } }
In normal
#include <stdio.h> #include <string.h> int main() { char str[100]; int i, length, isPalindrome = 1; printf("Enter a string: "); scanf("%s", str); length = strlen(str); for(i = 0; i < length / 2; i++) { if(str[i] != str[length - i - 1]) { isPalindrome = 0; break; } } if(isPalindrome) printf("Palindrome\n"); else printf("Not a Palindrome\n"); return 0; }
{{questionlistdata.blog_question_description}}
{{answer.blog_answer_description }}