Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8269839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:21:51+00:00 2026-06-08T06:21:51+00:00

I was going through the grep.c file (at https://www.cs.princeton.edu/~bwk/tpop.webpage/grep.c ) from Kernighan & Pike’s

  • 0

I was going through the grep.c file (at https://www.cs.princeton.edu/~bwk/tpop.webpage/grep.c) from Kernighan & Pike’s book The Practice of Programming.

If I search for regexp
^c*
in a file which contains nothing but
d
it will send these to match() function which will send ("c*", "d") to matchhere function.
matchhere sends (‘c’, "\0", "d") to matchstar which in turn sends ("\0", "d") to matchhere function. This will return 1 to the main grep() function

Where am I taking the values incorrectly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:21:52+00:00Added an answer on June 8, 2026 at 6:21 am

    Returning 1 is the correct answer. The regular expression ^c* matches zero or more copies of c at the beginning of a line, and a file containing d certainly matches that; in fact, every line of every file will match that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im going through the setup on http://www.railstutorial.org/chapters/static-pages#fig:autotest_green and im stuck on this particular error:
Going through K&R, I'm trying to get my head around C. I want to
Going through K&R I saw the following code snippet of a function, strcopy, which
Going through the tutorial here: http://www.asp.net/mvc/tutorials/iteration-4-make-the-application-loosely-coupled-cs I've noticed that they are passing the EF
While going through university and from following the development of SO, I've heard a
Going through this tutorial https://developers.google.com/web-toolkit/doc/latest/tutorial/RPC it is mentioned that to set up a call
while going through the class reference file for NSUserDefaults , I notice that the
Going through happstack-lite tutorial : we build functions that have return type of ServerPart
Going through some of my older Delphi projects and upgrading them to D2009, as
Going through Javascript documentation, I found the following two functions on a Javascript object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.